#set(title = "说说列表")
#@layoutToo()
#define main()

<table class="table tpl-table table-td-break ">
    <table>
        <form id="form" action="/blog/admin/addIdea" method="post">
            <textarea class="state1" name="idea" placeholder="开始胡说八道= =" style="width:500px;height:200px"></textarea>
            <input type="submit" value="保存" class="submit" id="submit"
                   style="margin-left: 50px;float: left;"/>&nbsp;
            <input type="reset" value="取消" class="btn btn-cancel" id="cancel" style="float: left">
        </form>
    </table>
    <form action="/blog/admin/batchDeleteIdea" method="post">
        <table>
            <thead>
            <tr>
                <th><input name="" type="checkbox" value="" onclick="swapCheck()"/></th>
                <th>序列</th>
                <th width="50%">说说</th>
                <th>创建时间</th>
                <th>基本操作</th>
            </tr>
            </thead>
            <h3>数量：#(idea.totalRow)</h3>
            #if(idea.totalRow > 0)
            <tbody>
            #for(idea : idea.list)
            <tr>
                <th><input name="List" type="checkbox" value="#(idea.id)"/></th>
                <th width="10%" type="checkbox" class="">#(for.count)</th>
                <th width="10%" type="checkbox" class="">#(idea.idea)</th>
                <th width="20%" type="checkbox" class="">#date(idea.createTime)</th>
                <th width="10%" type="checkbox" class=""><a id="hk_btn" data-ideaid="#(idea.id)" href="#">删除</a>
                <th>
            </tr>
            #end
            <tr><th colspan="6">
                <input type="submit" value="删除" class="btn " id="submit1"/>
            </th></tr>
            </tbody>
            #else
            <p class="center">没有数据...</p>
            #end
        </table>
    </form>
</table>

<div class="popup-wrap hidden" style="display:none">
        <div class="inner">
    <p align="center" ><b>是否确认删除</b></p>
    </div>
</div>

<script>


    $('#hk_btn').click(function () {
        var ideaId = $("#hk_btn").data("ideaid");
        console.log(ideaId);
        layer.open({
            title: '提示',
            content: $('.popup-wrap').html(),
            btn: ['删除', '取消'],

            yes:function () {
                $.ajax({
                    type: "POST",
                    url: '/ajax/blog/admin/delete',
                    data: {
                        id: ideaId
                    },
                    dataType: 'json',
//                    success: function () {
//                            layer.msg("删除成功！");
//
//                    },
                    error: function () {
                        layer.msg("删除成功！");
                    }
                });
            }
        });
    });

    //checkbox 全选/取消全选
    var isCheckAll = false;
    function swapCheck() {
        if (isCheckAll) {
            $("input[type='checkbox']").each(function () {
                this.checked = false;
            });
            isCheckAll = false;
        } else {
            $("input[type='checkbox']").each(function () {
                this.checked = true;
            });
            isCheckAll = true;
        }
    }
    $(function () {
        $('#submit').on('click', function () {
            if ($('.state1').val() == "") {
                alert("请输入内容");
                return false
            }
        })
    })


</script>
#include("/WEB-INF/view/common/blog_paginate.html")
#@paginate(idea.pageNumber, idea.totalPage, actionUrl, urlParams)
#end